package cn.edu.scau.cmi.chenbingquan.composite.consistent;

import java.util.ArrayList;

// 一致组合模式的组合节点
public class ConsistentComposite extends ConsistentComponent {

	public ConsistentComposite(String name) {
			this.name = name;
	}
		
	// 增加节点
	@Override
	public void addChild(ConsistentComponent child) {
		this.children.add(child);
	}

	// 删除节点
	@Override
	public void removeChild(ConsistentComponent child) {
		this.children.remove(child);
	}

	// 获取子节点数组
	@Override
	public ArrayList<ConsistentComponent> getChildren() {
		return this.children;
	}
	
	@Override
	public String toString() {
		return "团队：" + this.getName();
	}
	
	// 访问器与修改器
	@Override
	public String getName() {
		return this.name;
	}
		
	public void setName(String name) {
		this.name = name;
	}
}
